#include <stdio.h>  
#include <stdlib.h>  
#include <sys/types.h>  
#include <unistd.h>  
#include <wait.h>  
#include <string.h>  
  
int main() {  
    char commond[50];  
    int pid;  
    int ret;  
    while (1) {  
        printf("commond:");  
        scanf("%s", commond);  
        if (strcmp(commond, "exit") == 0)  
            exit(0);
        else {  
            pid = fork();  
            if (pid == -1) {  
                printf("error ocurred!");  
                exit(0);  
            } else if (pid == 0) {  
              ret= execlp(commond, commond, NULL);  
                if (ret == -1) { 
                   exit(0);  
                }  
            } 
else {  
                wait(NULL);  
           }  
       }  
  
    }  
    return 0;  
}  
